home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2006 May / PCWMAY06.iso / Software / Freeware / First Page 2006 3.00 / fp2006-final-3.00-setup.exe / {app} / Iscripts / Date & Calendars / first-day-of-the-week.izs < prev    next >
Text File  |  2005-09-27  |  3KB  |  139 lines

  1. <!NOWIZARD>
  2.  
  3. <!TITLE>First Day of the Week 
  4. <!/TITLE>
  5.  
  6. <!DESCRIPTION>This script will return the dates of the beginning of each week in any given month.<!/DESCRIPTION> 
  7.  
  8. <!CATEGORY>calenders<!/CATEGORY>
  9.  
  10. <!SCRIPT>
  11. <!-- START OF SCRIPT -->
  12.  
  13. <!-- HOW TO INSTALL FIRST DAY OF THE WEEK:
  14.  
  15.   1.  Copy the coding into the BODY of your HTML document  -->
  16.  
  17. <!-- STEP ONE: Paste this code into the BODY of your HTML document  -->
  18.  
  19. <BODY>
  20.  
  21. <SCRIPT LANGUAGE="JavaScript">
  22.  
  23. <!-- This script and many more are available free online at -->
  24. <!-- The JavaScript Source!! http://javascript.internet.com -->
  25.  
  26. <!-- Begin
  27. function WeekStart(Month, Year, StartOfWeekDay) {
  28.   _Date = new Date(Year, Month, 1)
  29.   _LastDate = new Date()
  30.   _LastDate = new Date(_Date)
  31.   _LastDate.setMonth(_Date.getMonth() + 1)
  32.   _LastDate.setHours(_LastDate.getHours() - 24)
  33.   _Returns = new Array()
  34.   if (StartOfWeekDay == null) {
  35.     StartOfWeekDay = 0
  36.   }
  37.   var I = 1
  38.   while (I <= _LastDate.getDate()) {
  39.     _Date.setDate(I)
  40.     if (_Date.getDay() == StartOfWeekDay) {
  41.       _Returns[_Returns.length] = new Date(_Date)
  42.       I += 6
  43.     }
  44.     I++
  45.   }
  46.   return(_Returns)
  47. }
  48. //  End -->
  49. </script>
  50.  
  51.  
  52. <FORM>
  53. Month <SELECT NAME=Month>
  54. <OPTION VALUE=0>Jan
  55. <OPTION VALUE=1>Feb
  56. <OPTION VALUE=2>Mar
  57. <OPTION VALUE=3>Apr
  58. <OPTION VALUE=4>May
  59. <OPTION VALUE=5>Jun
  60. <OPTION VALUE=6>Jul
  61. <OPTION VALUE=7>Aug
  62. <OPTION VALUE=8>Sep
  63. <OPTION VALUE=9>Oct
  64. <OPTION VALUE=10>Nov
  65. <OPTION VALUE=11>Dec
  66. </SELECT><BR>
  67. Year <INPUT TYPE=TEXT NAME=Year SIZE=4 MAXLENGTH=4><BR>
  68. <INPUT TYPE=BUTTON VALUE="Get Days" onClick="alert(WeekStart(document.forms[0].Month.value, document.forms[0].Year.value, 0))">
  69. </FORM>
  70. <!-- END OF SCRIPT -->
  71. <!/SCRIPT>
  72.  
  73. <!PREVIEW>
  74. <!-- START OF SCRIPT -->
  75.  
  76.  
  77. <!-- HOW TO INSTALL FIRST DAY OF THE WEEK:
  78.  
  79.   1.  Copy the coding into the BODY of your HTML document  -->
  80.  
  81. <!-- STEP ONE: Paste this code into the BODY of your HTML document  -->
  82.  
  83. <BODY>
  84.  
  85. <SCRIPT LANGUAGE="JavaScript">
  86.  
  87. <!-- This script and many more are available free online at -->
  88. <!-- The JavaScript Source!! http://javascript.internet.com -->
  89.  
  90. <!-- Begin
  91. function WeekStart(Month, Year, StartOfWeekDay) {
  92.   _Date = new Date(Year, Month, 1)
  93.   _LastDate = new Date()
  94.   _LastDate = new Date(_Date)
  95.   _LastDate.setMonth(_Date.getMonth() + 1)
  96.   _LastDate.setHours(_LastDate.getHours() - 24)
  97.   _Returns = new Array()
  98.   if (StartOfWeekDay == null) {
  99.     StartOfWeekDay = 0
  100.   }
  101.   var I = 1
  102.   while (I <= _LastDate.getDate()) {
  103.     _Date.setDate(I)
  104.     if (_Date.getDay() == StartOfWeekDay) {
  105.       _Returns[_Returns.length] = new Date(_Date)
  106.       I += 6
  107.     }
  108.     I++
  109.   }
  110.   return(_Returns)
  111. }
  112. //  End -->
  113. </script>
  114.  
  115.  
  116. <FORM>
  117. Month <SELECT NAME=Month>
  118. <OPTION VALUE=0>Jan
  119. <OPTION VALUE=1>Feb
  120. <OPTION VALUE=2>Mar
  121. <OPTION VALUE=3>Apr
  122. <OPTION VALUE=4>May
  123. <OPTION VALUE=5>Jun
  124. <OPTION VALUE=6>Jul
  125. <OPTION VALUE=7>Aug
  126. <OPTION VALUE=8>Sep
  127. <OPTION VALUE=9>Oct
  128. <OPTION VALUE=10>Nov
  129. <OPTION VALUE=11>Dec
  130. </SELECT><BR>
  131. Year <INPUT TYPE=TEXT NAME=Year SIZE=4 MAXLENGTH=4><BR>
  132. <INPUT TYPE=BUTTON VALUE="Get Days" onClick="alert(WeekStart(document.forms[0].Month.value, document.forms[0].Year.value, 0))">
  133. </FORM>
  134.  
  135.  
  136. <!-- END OF SCRIPT -->
  137. <!/PREVIEW>
  138.  
  139. <!RELATED>NONE<!/RELATED>